package TrainModel;

import Utilities.logFileIO;


public class MockTrainController
{
	public static void main(String[] args)
	{
		// Set up
		logFileIO lf = new logFileIO("ComponentTest", "csv");
		TrainModel myTrain = new TrainModel(1, 500);
		lf.write(myTrain.getStringHeaders());
		
		// Load Conductor
		lf.write(myTrain.toString());
		myTrain.toggleConductor();
		lf.write(myTrain.toString());
		
		// Set Power and run for awhile
		for(int i = 0; i < 1000; i++)
		{
			myTrain.setPower(4000);
			myTrain.tick();
			lf.write(myTrain.toString());
		}
		
		// Hit E Brake and wait
		for(int i = 0; i < 100; i++)
		{
			myTrain.setEBrake();
			myTrain.tick();
			lf.write(myTrain.toString());
		}
		
		// Open the doors
		myTrain.setDoorOpen(true);
		
		// Load Passengers
		myTrain.setPassengerFlow(50);
		
		// Set Power and run for awhile
		for(int i = 0; i < 100; i++)
		{
			myTrain.setPower(0);
			myTrain.tick();
			lf.write(myTrain.toString());
		}
		
		// Load Passengers
		myTrain.setPassengerFlow(50);
		
		// Set Power and run for awhile
		for(int i = 0; i < 100; i++)
		{
			myTrain.setPower(0);
			myTrain.tick();
			lf.write(myTrain.toString());
		}
		
		// Load Passengers
		myTrain.setPassengerFlow(100);
		
		// Set Power and run for awhile
		for(int i = 0; i < 100; i++)
		{
			myTrain.setPower(0);
			myTrain.tick();
			lf.write(myTrain.toString());
		}
				
		// Open the doors
		myTrain.setDoorOpen(false);
		
		// Set Power and run for awhile
		for(int i = 0; i < 1000; i++)
		{
			myTrain.setPower(4000);
			myTrain.tick();
			lf.write(myTrain.toString());
		}

		// Hit Service Brake and wait
		for(int i = 0; i < 100; i++)
		{
			myTrain.setBrake(15);
			myTrain.tick();
			lf.write(myTrain.toString());
		}
		
	}

}
